package com.ady.dogeyes.controller;


import com.ady.dogeyes.entity.Movie;
import com.ady.dogeyes.service.MovieService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author luohz
 * @since 2021-07-01
 */
@Controller
@RequestMapping("/movies")
public class MovieController {

    @Autowired
    private MovieService movieService;

    @GetMapping("/movie/{pn}")
    public String movieList(@PathVariable("pn") int pageNum, Model model){
        IPage<Movie> iPage = movieService.movieList(pageNum, 5);
        iPage.getRecords().forEach(System.out::println);
        model.addAttribute("moviePage",iPage);
        return "member/memberList";
    }

}

